package main

import "fmt"

func tupleSameProduct(nums []int) int {
	m := make(map[int]int, 0)
	for i := 0; i < len(nums); i++ {
		for j := i + 1; j < len(nums); j++ {
			m[nums[i]*nums[j]]++
		}
	}
	sum := 0
	for _, val := range m {
		if val > 1 {
			sum += ((val - 1) * val / 2) * 8
		}
	}
	return sum
}

func main() {
	fmt.Println(tupleSameProduct([]int{2, 3, 4, 6}))
}
